package avicit.bdp.dds.api.service;

import avicit.bdp.common.base.BaseService;
import avicit.bdp.dds.dao.entity.ProjectTable;
import avicit.bdp.dds.dao.mapper.ProjectTableMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * project service
 **/
@Service
public class ProjectTableService extends BaseService<ProjectTableMapper, ProjectTable> {


    /**
     * @param dataSourceId 数据源ID
     * @param projectId    项目ID
     * @param typeId       分类ID
     */
    public List<String> queryTableName(String projectId,String dataSourceId,String typeId){
        return this.mapper.queryTableName(projectId, dataSourceId, typeId);
    }

    /**
     * 根据表id获取数据源id
     * @param tableId 模型ID
     * @return 数据源id
     */
    public String getDatasourceIdByTableId(String tableId){
        return this.mapper.getDatasourceIdByTableId(tableId);
    }

    /**
     * 根据id获取表名
     * @param tableId 模型ID
     * @return 表名
     */
    public String getTableNameByTableId(String tableId) {
        return this.mapper.getTableNameByTableId(tableId);
    }


    public Integer selectModelByTypeId(String tableName, String projectId, String typeId) {
        return this.mapper.selectModelByTypeId(tableName, projectId ,typeId);
    }
}
